<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>资源设置</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <form id="ligerForm">
        <input name="strId" id="strId" type="hidden" value="${strId }">
        <div class="fieldset1 tabel_col tabel_col_s clearFix noBorder">
            <div class="fieldBox col_50">
                <div class="label">所属系统:</div>
                <div class="field">
                    <span id="sysCdNm"></span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">事业部:</div>
                <div class="field">
                    <span id="buOrgCdNm"></span>
                </div>
            </div>

            <div class="fieldBox col_50">
                <div class="label">用户名:</div>
                <div class="field">
                    <span id="usrNm"></span>
                </div>
            </div>

            <div class="fieldBox col_50">
                <div class="label">真实姓名:</div>
                <div class="field">
                    <span id="rlNm"></span>
                </div>
            </div>

            <div class="fieldBox col_50">
                <div class="label">手机号:</div>
                <div class="field">
                    <span id="mp"></span>
                </div>
            </div>

            <div class="fieldBox col_50">
                <div class="label">证件号:</div>
                <div class="field">
                    <span id="certNo"></span>
                </div>
            </div>

            <div class="fieldBox col_50">
                <div class="label">设备ID:</div>
                <div class="field">
                    <span id="deviceId"></span>
                </div>
            </div>

            <div class="fieldBox col_50">
                <div class="label">申诉结果:</div>
                <div class="field">
                    <select name="resultCd" id="resultCd" data-value="" validate="{required:true, select: true}">
                        <option value=" " selected>请选择</option>
                        <option value="1">同意</option>
                        <option value="2">驳回</option>
                    </select>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">申诉原因:</div>
                <div class="field" style="height: 80px">
                    <textarea name="appealCause"  id="appealCause" rows="6" disabled="true" class="l-textarea" style="width:99%"></textarea>

                </div>
            </div>
            <div class="fieldBox col_100">
                <div class="label">处理意见</div>
                <div class="field" style="width: 100%;">
                    <textarea name="appealOpinion"  id="appealOpinion" rows="6" class="l-textarea" style="width:99%"></textarea>
                </div>
            </div>
        </div>
    </form>
</div>
<script>

    $(function () {
        $("#ligerForm").ligerForm({
            validate: true
        });
        initData();
    });


    //当我点取消按钮的时候 就会消失
    frameElement.dialog.onCancel = function () {
        frameElement.dialog.close();
    }

    function setData(data) {
        var form = liger.get("ligerForm");
        form.setData({
            sysCd: data.sysCd,
            orgCd: data.orgCd,
            codeGrpCd: data.codeGrpCd,
            codeGrpNm: data.codeGrpNm,
            lmNm: data.lmNm,
            code: data.code,
            codeNm: data.codeNm,
            pCode: data.pcode,
            sortNo: data.sortNo,
            isSysDef: data.isSysDef,
            isValid: data.isValid,
            codeAttr1: data.codeAttr1,
            codeAttr2: data.codeAttr2,
            codeLvl: data.codeLvl,
            codeDesc: data.codeDesc
        });
        setDisable(data.isSysDef);
    };

    //定义父级调用事件
    frameElement.dialog.onOk = function (callback) {
        var ligerForm = liger.get("ligerForm")

        if (!ligerForm.valid()) {
            UIUtils.alertWarning(LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO);
            return false;
        }
        //获取表单数据
        var data = ligerForm.getData();
        var _id = $("#strId").val();
        var _resultCd = $("#resultCd").val();
        var _appealOpinion = $("#appealOpinion").val();
        data["id"] = _id;
        data["result"] = _resultCd;
        data["appealOpinion"] = _appealOpinion;

        var _url = '<%=path%>/system/sysusrappeallog/modify.do';
        AjaxUtils.ajaxPost(_url, data, function (msg) {
            if (msg.success == 1) {
                callback(true);
                frameElement.dialog.close();
            } else {
                UIUtils.alertError(msg.info);
            }
        }, true);
    }

    function initData() {
        debugger
        var _id = $("#strId").val();
        if (!_id || _id == "") return;
        var _url = '<%=path%>/system/sysusrappeallog/getById.do';
        $.ajax({
            type: 'get',
            dataType: 'json',
            data: {
                id: _id
            },
            url: _url,
            success: function (msg) {
                if (msg.success == 1) {
                    setData(msg.data);//设置数据
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //设置页面数据
    function setData(data) {
        debugger
        var vstr = "未知";
        if(data.result == "0") {
            vstr = "申诉中";
        }else if(data.result == "1") {
            vstr = "申诉成功";
        }else if(data.result == "2") {
            vstr = "申诉失败";
        }
        //获取到值data
        //获取到标签对应的form
        $("#sysCdNm").text(isNulltoNBSP(data.sysCdNm));
        $("#buOrgCdNm").text(isNulltoNBSP(data.buOrgCdNm));
        $("#usrNm").text(isNulltoNBSP(data.usrNm));
        $("#rlNm").text(isNulltoNBSP(data.rlNm));
        $("#mp").text(isNulltoNBSP(data.mp));
        $("#certNo").text(isNulltoNBSP(data.certNo));
        $("#deviceId").text(isNulltoNBSP(data.deviceId));
        $("#appealCause").text(isNulltoNBSP(data.appealCause));
    }

    function isNulltoNBSP(a) {
        if (a == null || a == undefined) {
            return ""
        } else {
            return a;
        }
    }

</script>
</body>
</html>